<!--#include file="../nav/admin_top.php" -->
<div class="titleDiv">
	<div class="titleCaption">
		<span class="captionSpan">菜品库存</span>
		<span class="totalSpan"> <label id="captionNum"></label> </span>
	</div>
</div>
<div class="menuBg">
	<a class="menuAdd" href="{url::build('admin_ku','add')}">添加库存批次</a>
  <div style="clear:both"></div>
</div>
<div style="margin:10px auto">
	搜索：
	<input type="text" maxlength="12" id="keywords" class="searchs" /> 
	<input type="button"  onclick="fnSearchs()" value="查 询"  />  	
</div> 
<div id="grids"></div> 
<script type="text/javascript">
var url_list = '/admin_ku/index_list'; 

$().ready(function(){
	o2js.build('ymprompt'); 
	o2js.build('o2grid');
	showLoading();
	grids = new o2Grid({
		bind:'grids', 
		rowNum:10,
		pageCtl:{
			top:false,bottom:false
		},
		url:url_list,
		singleSelect:true,
		imgpath:'/misc/vendors/o2js/o2grid/image',
		cols:[ 
			{index:'id',mapping:'a.id', name:'序号', width:40,sortable:false, func:function(val,row_index,column_name,json,R){
				 return  '<span title="ID：'+json.id+'" >'+((R.page - 1)*R.rowNum + (row_index+1))+'</span>';
			}},
			{index:'name',mapping:'a.name', name:'库存批次标识',sortable:false, width:150,func:function(val,row_index,column_name,json,R){
					return val;
				}
			},
			{index:'plandate',mapping:'a.plandate', name:'计划到货日期',sortable:false, width:120,func:function(val,row_index,column_name,json,R){
					return val;
				}
			},
			{index:'acdate',mapping:'a.acdate', name:'实际到货日期',sortable:false, width:120,func:function(val,row_index,column_name,json,R){
					if(!val){
						return '';
					}else{
						return val;
					}
				}
			},
			{index:'id',mapping:'a.id', name:'操作'	, width:470,sortable:false,func:function(val,row_index,column_name,json,R){
					var s = '<a href="javascript:void(0)" onclick="fnDel('+json.id+')"><img src="/misc/images/icos/del.gif" /> 删除</a> ';
					s += '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; 
					s += '<a href="/admin_ku/plan?id='+json.id+'" >会服填写</a> ';
					s += '&nbsp;&nbsp;&nbsp;&nbsp; ';
					s += '<a href="/admin_ku/chu?id='+json.id+'" >出库填写</a> ';
					s += '&nbsp;&nbsp;&nbsp;&nbsp; ';
					s += '<a href="/admin_ku/gou?id='+json.id+'" >采购填写</a> ';
					s += '&nbsp;&nbsp;&nbsp;&nbsp; ';
					s += '<a href="/admin_ku/make?id='+json.id+'" >工厂填写</a> ';
					s += '&nbsp;&nbsp;&nbsp;&nbsp; ';
					s += '<a href="/admin_ku/view?id='+json.id+'" >查阅</a> ';
					return s;
				}
			}
		],
		endfunc:function(obj){
		}
	});
	fnSearchs();	 
	$('#keywords').keypress(function(e){
		if(e.keyCode==13||e.keyCode==10){
			fnSearchs();
		}
	});
});   
function fnSearchs(){
	grids.setBaseParams({
		keywords:encodeURIComponent($('#keywords').val())
	}); 
	grids.load(1); 
}
 /* 删除单个 */
function fnDel(id){
	fnConfirm({
		str:"确认删除？",
		func_true:function(e){
			fnLoading('正在删除');
			$('button').attr('disabled','disabled');
			$.post(
				'/admin_ku/del',
				{
					id:id
				},
				function(e){
					fnLoadingEnd();
					$('button').attr('disabled','');
					var ok = errorHandler(e);
					if(ok && ok.success=="1"){　 
						grids.reload();
					}
				}
			);
		}
	});
}


</script>
<!--#include file="../nav/admin_bottom.php" -->